package com.david.system.mapper;

import com.david.system.pojo.Entity.VendorEntity;
import com.david.system.pojo.VO.VendorVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface VendorMapper {
    @Select("select sv.id, sv.name,sv.type, sv.code, sv.address, sv.contact, sv.job, sv.phone, sv.legal_person, sv.registered_capital, sv.credit_code, sv.bank, sv.account, svs.name as status from sys_vendor sv left join sys_vendor_status svs on sv.status_id = svs.id")
    List<VendorVO> selectVendorAll();

    @Select("select id from sys_vendor_status where name = #{status}")
    Integer selectVendorStatusIdByStatus(String status);

    void updateVendor(VendorEntity vendorEntity);

    @Delete("delete from sys_vendor where id = #{id}")
    void deleteVendorById(Integer id);

    void insertVendor(VendorEntity vendorEntity);
}
